﻿using System.Collections;

Hashtable ht = new Hashtable();
ht.Add("01", "jack");
ht.Add("02", "baby");
ht.Add("03", "tom");
ht.Add("04", "jerry");

if (ht.ContainsValue("tom"))
{
    Console.WriteLine("this student name is already in the list");
}
else
{
    ht.Add("05", "tom");
}

// 获取键的集合
ICollection keys = ht.Keys;
foreach (var item in keys)
{
    Console.WriteLine(item + " " + ht[item]);
}

Console.ReadLine();